      1  import java.awt.Color;

      2

      3  public class Negative

      4  {

      5     public static void main(String[] args)

      6     {

      7        Picture pic = new Picture();

      8        pic.load("queen-mary.png");

      9        for (int x = 0; x < pic.getWidth(); x++)

     10        {

     11           for (int y = 0; y < pic.getHeight(); y++)

     12           {

     13              Color original = pic.getColorAt(x, y);

     14              Color negative = new Color(255 - original.getRed(),

     15                 255 - original.getGreen(),

     16                 255 - original.getBlue());

     17              pic.setColorAt(x, y, negative);

     18           }

     19        }

     20     }

     21  }